package charts;

import java.awt.BorderLayout;
import java.awt.Color;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PlotOrientation;

/**
 * @author Manseer Marcel  
 * @author Plavsic Maja
 * @author Pretsch Paul
 */
public class BarChart extends Chart {
	
	private static final long serialVersionUID = 1L;
	private static final Color barColor = Color.getHSBColor((float)0.6863, (float)0.4863, (float)0.3059);
	
	public BarChart()
	{
		super();
		
		setLayout(new BorderLayout());
		
		//Create a chart
		JFreeChart chart = ChartFactory.createBarChart(
				"Tweets/day", "Day", "Tweets", this.data,
				PlotOrientation.VERTICAL, true, true, false);
		//Customize properties
		chart.getCategoryPlot().getRenderer().setSeriesPaint(0, barColor);
		chart.getCategoryPlot().getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
		chart.getCategoryPlot().getRangeAxis().setAutoRangeMinimumSize(1);
		chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4.0));

		//Add new one to pane
		add(new ChartPanel(chart), BorderLayout.CENTER);
	}
	
}
